package com.facebook.common.soloader;

public class SoLoaderShim {
    public static class DefaultHandler implements Handler {
        public DefaultHandler() {

        }

        public void loadLibrary(String lib) {
            System.loadLibrary(lib);
        }
    }

    public interface Handler {
        void loadLibrary(String lib);
    }

    private static volatile Handler sHandler = new DefaultHandler();

    public SoLoaderShim() {

    }

    public static void loadLibrary(String arg1) {
        SoLoaderShim.sHandler.loadLibrary(arg1);
    }

    public static void setHandler(Handler arg2) {
        if (arg2 == null) {
            throw new NullPointerException("Handler cannot be null");
        }

        SoLoaderShim.sHandler = arg2;
    }

    public static void setInTestMode() {
        SoLoaderShim.setHandler(new Handler() {
            @Override
            public void loadLibrary(String lib) {

            }
        });
    }
}

